﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;

using Infraestructure.CrossCutting.IoC;


namespace Infraestructure.CrossCutting.Tests
{

    /// <summary>
    /// Test class for IoC
    /// </summary>
    [TestClass()]
    public class IoCTests
    {


        #region Public Test Methods


        [TestMethod()]
        public void ShortLivedManager_IsTransient_Test()
        {
            //Arrange
            ShortLivedObject actual = IoCFactory.Instance.CurrentContainer.Resolve<ShortLivedObject>();

            //Act
            actual.Dispose();
            ShortLivedObject newShortLivedObject = IoCFactory.Instance.CurrentContainer.Resolve<ShortLivedObject>();
            //Assert
            Assert.AreNotEqual(actual, newShortLivedObject);
            Assert.IsFalse(newShortLivedObject.IsDisposed);
        }


        #endregion Public Test Methods


    }

}
